/// @Classname : HcDialogPage
/// @Author :
/// @Time : 2024-03-15 8:54
/// @Description : //todo

import 'package:flutter/material.dart';
import 'package:hc_ui/config/hc_customer_config.dart';
import 'package:hc_ui/theme/hc_cell_group_theme.dart';
import 'package:hc_ui/theme/hc_common_theme.dart';
import 'package:hc_ui/theme/hc_title_theme.dart';
import 'package:hc_ui/utils/hc_dialog_util.dart';
import 'package:hc_ui/widget/button_panel/hc_dialog_button_panel.dart';
import 'package:hc_ui/widget/cell/hc_cell.dart';
import 'package:hc_ui/widget/cell_group/hc_cell_group.dart';
import 'package:hc_ui/widget/title/hc_title.dart';

class HcDialogPage extends StatefulWidget {
  const HcDialogPage({Key? key}) : super(key: key);

  @override
  State<HcDialogPage> createState() => _HcDialogPageState();
}

class _HcDialogPageState extends State<HcDialogPage> {
  @override
  Widget build(BuildContext context) {
    HcCommonTheme theme = HcCustomerConfig().allTheme.commonTheme;
    return Scaffold(
      backgroundColor: theme.fillPageColor,
      appBar: AppBar(
        title: const Text('HcDialogPage'),
      ),
      body: ListView(
        padding: EdgeInsets.symmetric(
            vertical: theme.vSpacingPage, horizontal: theme.hSpacingPage),
        children: [
          HcCellGroup(
              insideTitle: const HcTitle.dot(
                title: "单一内容",
                titleFontSize: 12.0,
              ),
              children: [
                HcCell(
                  title: "仅有图标",
                  onTap: () {
                    HcDialogUtil.showMessageDialog(
                      context: context,
                      icon: Icon(Icons.warning),
                      contentText: null,
                    );
                  },
                ),
                HcCell(
                  title: "仅有标题",
                  onTap: () {
                    HcDialogUtil.showMessageDialog(
                      context: context,
                      contentText: null,
                      titleText: '这是一个无按钮的弹窗',
                    );
                  },
                ),
                HcCell(
                  title: "仅有信息",
                  onTap: () {
                    HcDialogUtil.showMessageDialog(
                      context: context,
                      contentText: '这是一个无按钮的弹窗',
                    );
                  },
                ),
                HcCell(
                  title: "仅有警告文字",
                  onTap: () {
                    HcDialogUtil.showMessageDialog(
                      context: context,
                      contentText: null,
                      warningText: '这是一个无按钮的弹窗',
                    );
                  },
                )
              ]),
          HcCellGroup(
              themeData: HcCellGroupTheme(margin: EdgeInsets.only(top: 10)),
              insideTitle: HcTitle.dot(
                title: "组合内容",
                themeData:
                    HcTitleTheme(titleStyle: const TextStyle(fontSize: 14)),
              ),
              children: [
                HcCell(
                  title: "图标+标题",
                  onTap: () {
                    HcDialogUtil.showMessageDialog(
                      context: context,
                      icon: Icon(Icons.warning),
                      titleText: "这里是标题",
                      contentText: null,
                    );
                  },
                ),
                HcCell(
                  title: "图标+信息",
                  onTap: () {
                    HcDialogUtil.showMessageDialog(
                      context: context,
                      contentText: "这里是内容",
                      titleText: '这是一个无按钮的弹窗',
                    );
                  },
                ),
                HcCell(
                  title: "图标+标题+信息",
                  onTap: () {
                    HcDialogUtil.showMessageDialog(
                      context: context,
                      icon: Icon(Icons.warning),
                      titleText: "这里是文字",
                      contentText: '这是一个无按钮的弹窗',
                    );
                  },
                ),
                HcCell(
                  title: "图标+标题+信息+警告文字",
                  onTap: () {
                    HcDialogUtil.showMessageDialog(
                      context: context,
                      icon: Icon(Icons.warning),
                      titleText: "title",
                      contentText: "按钮啊",
                      warningText: '这是一个无按钮的弹窗',
                    );
                  },
                )
              ]),
          HcCellGroup(
              themeData: HcCellGroupTheme(margin: EdgeInsets.only(top: 10)),
              insideTitle: HcTitle.dot(
                title: "单按钮类型",
                themeData: HcTitleTheme(
                  titleStyle: const TextStyle(fontSize: 14),
                ),
              ),
              children: [
                HcCell(
                  title: "实心按钮类型",
                  onTap: () {
                    HcDialogUtil.showAlertDialog(
                      context: context,
                      icon: Icon(Icons.warning),
                      titleText: "title",
                      contentMinHeight: 0.0,
                      contentText: "按钮啊",
                      warningText: '只有一个按钮',
                      sureText: '我知道了',
                    );
                  },
                ),
                HcCell(
                  title: "文字按钮类型",
                  onTap: () {
                    HcDialogUtil.showAlertDialog(
                      context: context,
                      contentMinHeight: 0.0,
                      icon: Icon(Icons.warning),
                      titleText: "title",
                      contentText: "按钮啊",
                      buttonType: HcButtonType.text,
                      warningText: '这是一个无按钮的弹窗',
                      sureText: '我知道了',
                    );
                  },
                ),
                HcCell(
                  title: "幽灵按钮类型",
                  onTap: () {
                    HcDialogUtil.showAlertDialog(
                      context: context,
                      icon: Icon(Icons.warning),
                      titleText: "title",
                      contentMinHeight: 0.0,
                      contentText: "按钮啊",
                      buttonType: HcButtonType.outlined,
                      warningText: '这是一个无按钮的弹窗',
                      sureText: '我知道了',
                    );
                  },
                ),
              ]),
          HcCellGroup(
              themeData: HcCellGroupTheme(margin: EdgeInsets.only(top: 10)),
              insideTitle: HcTitle.dot(
                title: "双按钮类型",
                themeData: HcTitleTheme(
                  titleStyle: const TextStyle(fontSize: 14),
                ),
              ),
              children: [
                HcCell(
                  title: "主按钮实心+取消按钮空心",
                  onTap: () {
                    HcDialogUtil.showConfirmBtnDialog(
                      context: context,
                      icon: Icon(Icons.warning),
                      titleText: "title",
                      contentMinHeight: 0.0,
                      contentText: "按钮啊",
                      warningText: '只有一个按钮',
                      sureText: '我知道了',
                      cancelText: '取消',
                      sureBtnOnTap: () {},
                      cancelBtnOnTap: () {},
                    );
                  },
                ),
                HcCell(
                  title: "主按钮实心+取消按钮文字",
                  onTap: () {
                    HcDialogUtil.showConfirmBtnDialog(
                      context: context,
                      contentMinHeight: 0.0,
                      icon: Icon(Icons.warning),
                      titleText: "title",
                      contentText: "按钮啊",
                      sureBtnType: HcButtonType.elevated,
                      cancelBtnType: HcButtonType.text,
                      warningText: '这是一个无按钮的弹窗',
                      sureText: '我知道了',
                      cancelText: '取消',
                      sureBtnOnTap: () {},
                      cancelBtnOnTap: () {},
                    );
                  },
                ),
                HcCell(
                  title: "主副为实心",
                  onTap: () {
                    HcDialogUtil.showConfirmBtnDialog(
                      context: context,
                      contentMinHeight: 0.0,
                      icon: Icon(Icons.warning),
                      titleText: "title",
                      contentText: "按钮啊",
                      sureBtnType: HcButtonType.elevated,
                      cancelBtnType: HcButtonType.elevated,
                      warningText: '这是一个无按钮的弹窗',
                      sureText: '我知道了',
                      cancelText: '取消',
                      sureBtnOnTap: () {},
                      cancelBtnOnTap: () {},
                    );
                  },
                ),
                HcCell(
                  title: "主副为空心",
                  onTap: () {
                    HcDialogUtil.showConfirmBtnDialog(
                      context: context,
                      contentMinHeight: 0.0,
                      icon: Icon(Icons.warning),
                      titleText: "title",
                      contentText: "按钮啊",
                      sureBtnType: HcButtonType.outlined,
                      cancelBtnType: HcButtonType.outlined,
                      warningText: '这是一个无按钮的弹窗',
                      sureText: '我知道了',
                      cancelText: '取消',
                      sureBtnOnTap: () {},
                      cancelBtnOnTap: () {},
                    );
                  },
                ),
                HcCell(
                  title: "主副按钮文字",
                  onTap: () {
                    HcDialogUtil.showConfirmBtnDialog(
                      context: context,
                      contentMinHeight: 0.0,
                      icon: Icon(Icons.warning),
                      titleText: "title",
                      contentText: "按钮啊",
                      sureBtnType: HcButtonType.text,
                      cancelBtnType: HcButtonType.text,
                      warningText: '这是一个无按钮的弹窗',
                      sureText: '我知道了',
                      cancelText: '取消',
                      sureBtnOnTap: () {},
                      cancelBtnOnTap: () {},
                    );
                  },
                ),
              ])
        ],
      ),
    );
  }
}
